|
1
|
|
|
// Copyright © 2017 TangDongxin |
|
2
|
|
|
// |
|
3
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining |
|
4
|
|
|
// a copy of this software and associated documentation files (the "Software"), |
|
5
|
|
|
// to deal in the Software without restriction, including without limitation |
|
6
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
7
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the |
|
8
|
|
|
// Software is furnished to do so, subject to the following conditions: |
|
9
|
|
|
// |
|
10
|
|
|
// The above copyright notice and this permission notice shall be included |
|
11
|
|
|
// in all copies or substantial portions of the Software. |
|
12
|
|
|
// |
|
13
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
14
|
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
15
|
|
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
16
|
|
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
17
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
18
|
|
|
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
|
19
|
|
|
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
20
|
|
|
|
|
21
|
|
|
// =========================================== |
|
22
|
|
|
// JSON RENOVATER |
|
23
|
|
|
// =========================================== |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
function onRenovate(result) { |
|
|
|
|
|
|
27
|
|
|
if (dontBeatify) { |
|
|
|
|
|
|
28
|
|
|
return; |
|
29
|
|
|
} |
|
30
|
|
|
var items = document.getElementsByClassName('S' + RAND); |
|
|
|
|
|
|
31
|
|
|
for (var i = 0; i < items.length; i++) { |
|
32
|
|
|
if (isJSON(items[i].innerHTML)) { |
|
33
|
|
|
items[i].setAttribute("content", '<str style="color:#888;"> [→ str ←] </str><json style="color:#888;"> [← json →] </json>' + items[i].innerHTML); |
|
34
|
|
|
items[i].setAttribute("json", items[i].innerHTML); |
|
35
|
|
|
items[i].innerHTML = '<str style="color:#888;"> [← str →] </str><json style="color:#888;"> [← json →] </json>' + items[i].innerHTML.substring(0, 10) + ' ··· ' + items[i].innerHTML.substr(-10, 10); |
|
36
|
|
|
} else if (items[i].innerHTML.length > 300) { |
|
37
|
|
|
items[i].setAttribute("content", '<str style="color:#888;"> [→ str ←] </str>' + items[i].innerHTML); |
|
38
|
|
|
items[i].innerHTML = '<str style="color:#888;"> [← str →] </str>' + items[i].innerHTML.substring(0, 10) + ' ··· ' + items[i].innerHTML.substr(-10, 10); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.